﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace THenu.TinyHourseLib.DesignPattern.Structural_Patterns.Adapter_Pattern
{
 
    /// <summary>
    /// 创建  Adaptee 在 Target 上的适配器 
    /// 为 Target 类适配,链接其 Request 至  Adaptee 的 SpecificRequest
    /// </summary>
    public class Adapter : Target
    {
        private Adaptee _adaptee = new Adaptee();

        public override void Request()
        {
            // Possibly do some other work  and then call SpecificRequest
            _adaptee.SpecificRequest();
        }
    }
    /// <summary>
    /// 适配的目标
    /// </summary>
    public class Target
    {
        public virtual void Request()
        {
            Console.WriteLine("Called Target Request()");
        }
    }
    /// <summary>
    /// 需要改造的接口
    /// </summary>
    public class Adaptee
    {
        public void SpecificRequest()
        {
            Console.WriteLine("Called SpecificRequest()");
        }
    }
}
